<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>购物车</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="./index.css">
    <!-- 引入组件库 -->
  
    <script src="./vue.js"></script>
    <script src="./index.js"></script>
</head>

<body>
    <div id="app">
      数量<input type="text" v-model="num"> 
      价格<input type="text" v-model="price"> 
         <p>{{sum}}</p>
    </div>
    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                num:0,
                price:0
                
            },
            computed:{
                sum(){
                    return this.num*this.price;
                }
            }
            
        });
    </script>

</body>

</html>